<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <style>
        body{
            text-align:center;
        }
        canvas {
            border: 1px solid #000;

        }
    </style>
</head>
<body>
<canvas id="cas" width="500" height="500"></canvas>
</body>
<script>
    function toAngle ( radian ) {
        return radian * 180 / Math.PI;
    }
    function toRadian ( angle ) {
        return angle * Math.PI / 180;
    }


    var cas=document.getElementById('cas');
    var ctx=cas.getContext('2d');


    //首先找圆心和设置半径

    var x=cas.width/ 2,
        y=cas.height/ 2,
        r=100;

    //设置起始点和每个的角度
    var step=120,
        start=-90;

    //颜色的数组
    var colors=['hotpink','skyblue','orange'];

    //绘制饼

    for(var i=0;i<3;i++){
        ctx.beginPath();
        ctx.fillStyle=colors[i];
        ctx.moveTo(x,y);
        ctx.arc(x,y,r,toRadian(start),toRadian(start+=step));
        ctx.fill();

        //绘制直线
        var x1,y1;
        var distance=30;
        ctx.beginPath();
        ctx.strokeStyle=colors[i];
        ctx.moveTo(x,y);
        x1=x+(r+distance)*
    }

</script>
</html>